package com.company.structural.flyweight_pattern.client;

import com.company.structural.flyweight_pattern.flyweight.IgoChessman;
import com.company.structural.flyweight_pattern.flyweight_factory.IgoChessmanFactory;
import com.company.structural.flyweight_pattern.unshared_concreate_filyweight.Coordinates;

/**
 * @ClassName Client
 * @Author tiezheng.han
 * @Date 2020/9/1 16:40
 **/
public class Client {
    public static void main(String[] args) {
        IgoChessman black1,black3,black2,white1,white2;

        // 通过享元工厂获取3颗黑棋子
        black1 = IgoChessmanFactory.getIgoCHessman("b");
        black2 = IgoChessmanFactory.getIgoCHessman("b");
        black3 = IgoChessmanFactory.getIgoCHessman("b");
        System.out.println("判断两颗黑子是否相同：" + (black1 == black2));

        // 通过享元工厂获取3颗白棋子
        white1 = IgoChessmanFactory.getIgoCHessman("w");
        white2 = IgoChessmanFactory.getIgoCHessman("w");
        System.out.println("判断两颗白子是否相同：" + (white1 == white2));

        black1.display(new Coordinates(1,2));
        black2.display(new Coordinates(3,4));
        black3.display(new Coordinates(1,3));
        white1.display(new Coordinates(2,5));
        white2.display(new Coordinates(2,4));

//        String PurchaseRequest = "abcd";
//        String b = "abcd";
//        String c = "ab"+"cd";
//        String d = "ab";
//        d += "cd";
//
//        String str = new String("aaaa");
//        String str1 = new String("aaaa");
//
//        System.out.println(PurchaseRequest == b);
//        System.out.println(PurchaseRequest ==c);
//        System.out.println(PurchaseRequest == d);
//        System.out.println(str == str1);

    }
}
